home *** CD-ROM | disk | FTP | other *** search
/ Aminet 31 / Aminet 31 (1999)(Schatztruhe)[!][Jun 1999].iso / Aminet / util / libs / chunky_dev.lha / chunky_dev / Demos / _shared / screen.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-03-15  |  1.4 KB  |  62 lines

  1. //
  2. // chunky.library examples
  3. // MODULE: screen opening and closing commands
  4. //
  5. // http://www.irrelevant.org/~oondy/chunky/
  6. // Public domain.  (c) 1999 Rosande Limited, all rights reserved.
  7.  
  8. #include <exec/types.h>
  9. #include <intuition/intuition.h>
  10. #include <pragma/intuition_lib.h>
  11. #include <pragma/graphics_lib.h>
  12.  
  13. #include "screen.h"
  14.  
  15. struct Screen *DemoScreen = NULL;
  16. struct Window *DemoWindow = NULL;
  17.  
  18. BOOL DEMO_OpenScreen(ULONG Width, ULONG Height, ULONG Flags,
  19.  void *ColourTable32)
  20. {
  21.   struct Screen *WB = (struct Screen *)OpenWorkBench();
  22.   if(!DemoScreen)
  23.   {
  24.     if(DemoScreen = OpenScreenTags(NULL,
  25.        SA_Width, Width,
  26.        SA_Height, Height,
  27.        SA_Depth, 8,
  28.        SA_Title, "chunky.library Demo Screen",
  29.        SA_DisplayID, GetVPModeID(&WB->ViewPort),
  30.        ColourTable32 ? SA_Colors32 : TAG_SKIP, ColourTable32,
  31.        TAG_DONE))
  32.     {
  33.       if(DemoWindow = OpenWindowTags(NULL,
  34.         WA_Width, Width,
  35.         WA_Height, Height,
  36.         WA_IDCMP, IDCMP_CLOSEWINDOW,
  37.         WA_CloseGadget, TRUE,
  38.         WA_Borderless,  TRUE,
  39.         WA_Activate, TRUE,
  40.         WA_CustomScreen, DemoScreen,
  41.         TAG_DONE))
  42.       {
  43.         // Opened the demo screen and window
  44.         return(TRUE);
  45.       }
  46.     }
  47.   }
  48.   return(FALSE);
  49. }
  50.  
  51. void DEMO_CloseScreen(void)
  52. {
  53.   if(DemoWindow)
  54.   {
  55.     CloseWindow(DemoWindow); DemoWindow = NULL;
  56.   }
  57.   if(DemoScreen)
  58.   {
  59.     CloseScreen(DemoScreen); DemoScreen = NULL;
  60.   }
  61. }
  62.